<%@page import="com.canin.model.Member"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<div id="rightPan">
	<div id="rightbodyPan">

		<div id="headerTab" style=" height:55px; ">
			<a style="width: 90px;" id="clicked">ข้อมูลส่วนตัว</a>
			<a style="width: 60px;" href="<s:url action="dog_toAdd"/>">เพิ่มสุนัข</a>
			<a style="width: 200px;" href="<s:url action="dog_edit"/>">ปรับปรุงข้อมูลสุนัขให้เป็นปัจจุบัน</a>
			<a style="width: 200px; margin-top: 5px; " href="<s:url action="sugg_food"/>">สั่งซื้ออาหารสำหรับสุนัขของฉัน</a>
			<a style="width: 210px; margin-top: 5px; " href="<s:url action="sugg_tool"/>">สั่งซื้ออุปกรณ์สำหรับสุนัขของฉัน</a>
		</div>
		
		<script type="text/javascript">
			function edit(what) {
				if ( document.getElementById('button').value == "แก้ไข" )
				{
					document.getElementById('button').value = "ตกลง";
					
					document.getElementById('first_Name').disabled = false;
					document.getElementById('lastName').disabled = false;
					document.getElementById('email').disabled = false;
					document.getElementById('telephone').disabled = false;
					document.getElementById('address_Line1').disabled = false;
					document.getElementById('address_Line2').disabled = false;
					document.getElementById('address_Line3').disabled = false;
					document.getElementById('address_Line4').disabled = false;
					document.getElementById('post_Code').disabled = false;
				}
				else
				{
					document.getElementById( 'member_edit' ).submit();
					
					document.getElementById('button').value = "แก้ไข";

					document.getElementById('first_Name').disabled = true;
					document.getElementById('lastName').disabled = true;
					document.getElementById('email').disabled = true;
					document.getElementById('telephone').disabled = true;
					document.getElementById('address_Line1').disabled = true;
					document.getElementById('address_Line2').disabled = true;
					document.getElementById('address_Line3').disabled = true;
					document.getElementById('address_Line4').disabled = true;
					document.getElementById('post_Code').disabled = true;
				}
			}
		</script>

		<s:form id="member_edit" action="member_edit" theme="simple">

			<table>
				<tr>
					<td id="slabel" style="padding-top: 30px;">ชื่อ:</td>
					<td style="padding-top: 30px;"><s:textfield
							value="%{#session.MEMBER.first_Name}" 
							name="memberForm.first_Name" size="25" id="first_Name" disabled="true"></s:textfield></td>
				</tr>
				<tr>
					<td id="slabel">นามสกุล:</td>
					<td><s:textfield value="%{#session.MEMBER.last_Name}"
							name="memberForm.last_Name" size="25" id="lastName" disabled="true"></s:textfield></td>
				</tr>
				<tr>
					<td id="slabel">อีเมล์:</td>
					<td><s:textfield value="%{#session.MEMBER.email}"
							name="memberForm.email" size="40" id="email" disabled="true"></s:textfield></td>
				</tr>
				<tr>
					<td id="slabel">เบอร์โทร:</td>
					<td><s:textfield value="%{#session.MEMBER.telephone}" id="telephone" disabled="true"
							name="memberForm.telephone" size="25"></s:textfield></td>
				</tr>
				<tr>
					<td id="slabel">ที่อยู่:</td>
					<td><s:textfield value="%{#session.MEMBER.address_Line1}" id="address_Line1" disabled="true"
							name="memberForm.address_Line1" size="50"></s:textfield></td>
				</tr>
				<tr>
					<td></td>
					<td><s:textfield value="%{#session.MEMBER.address_Line2}" id="address_Line2" disabled="true"
							name="memberForm.address_Line2" size="50"></s:textfield></td>
				</tr>
				<tr>
					<td></td>
					<td><s:textfield value="%{#session.MEMBER.address_Line3}" id="address_Line3" disabled="true"
							name="memberForm.address_Line3" size="50"></s:textfield></td>
				</tr>
				<tr>
					<td></td>
					<td><s:textfield value="%{#session.MEMBER.address_Line4}" id="address_Line4" disabled="true"
							name="memberForm.address_Line4" size="50"></s:textfield></td>
				</tr>
				<tr>
					<td id="slabel">รหัสไปรษณีย์:</td>
					<td><s:textfield value="%{#session.MEMBER.post_Code}" id="post_Code" disabled="true"
							name="memberForm.post_Code" size="15"></s:textfield></td>
				</tr>
			</table>

			<input onclick="edit()"
				type="button" value="แก้ไข" id="button"
				style="margin: 30px 0 0 250px;"></input>

		</s:form>

	</div>
</div>

